package com.asialjim.wechat.official.message.handler.message;

import com.asialjim.wechat.database.DataBaseService;
import com.asialjim.wechat.message.WeChatMessage;
import com.asialjim.wechat.message.output.WeChatOutputMessage;
import com.asialjim.wechat.msgcrypt.WxBizMsgCryptService;
import com.asialjim.wechat.official.message.WeChatOfficialMessageType;
import com.asialjim.wechat.official.message.input.WeChatInputVoiceMessage;
import com.asialjim.wechat.official.message.wiki.MsgWikiFunction;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RedissonClient;

import java.util.Map;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: VoiceMessageHandler ]</i></h2><strong>
 * <p> voice message handler
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 *
 * @author Asial Jim &nbsp;&nbsp; <span>Email:<a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @version 1.0.0
 * @since 2021/3/16   &nbsp;&nbsp; JDK 8
 */
@Slf4j
public class VoiceMessageHandler extends WikiMessageHandler {
    public VoiceMessageHandler(WxBizMsgCryptService cryptService, DataBaseService dataBaseService, Map<String, MsgWikiFunction> wikiFunctionMap, RedissonClient redissonClient) {
        super(cryptService,dataBaseService,wikiFunctionMap,redissonClient);
    }

    @Override
    protected WeChatOutputMessage output(WeChatMessage callMessage){
        WeChatInputVoiceMessage message = (WeChatInputVoiceMessage) callMessage;
        String content = message.getRecognition();

        return handleWikiMessage(message, content);
    }


    @Override
    public String messageTypeName() {
        return WeChatOfficialMessageType.VOICE.name();
    }
}
